#ifdef TIME_4_SKIP
#else
#include "view_time_4.h"
#include "view_time_4.inc"
#include "view_time_0.h"
#include "display_ctrl.h"
#include "platform_assert.h"
#include "lfs_file_manager_auto.h"
#include "rtc.h"
#include "datetime.h"
#include "blecom.h"
#include "battery_ctrl.h"
#include "sport_his.h"
#include "display_ctrl.h"
#include "display_interface_240x240.h"
#include "datetime.h"
#include "heart_rate_interface.h"
#include "font/num_font.h"
#include "font_mngr.h"
#include "view_common.h"
#include "app_trace.h"
#include "weather_ctrl.h"
#include "view_times.h"
static void show_time_4_icon(void)
{
    disp_draw_user_image(11, 135, img_time_0_step);
    disp_draw_user_image(11, 165, img_time_0_heart_rate);
}
static void show_time_4_steps(void)
{
    int steps = disp_ctrl.com_data.i_temp[11];
    int units = 10000;
    int num = 0;
    int x = 38;
    int const y = 136;
    for (int i = 0; i < 5; i++)
    {
        num = steps / units;
        steps = steps % units;
        disp_draw_user_image(x, y, img_time_0_num_TAB[num]);
        units /= 10;
        x += 9 + 2;
    }
}
static void show_time_4_heart_rate(void)
{
    int heart_rate = disp_ctrl.com_data.i_temp[17];
    if (heart_rate == 0)
    {
        int x = 39;
        int const y = 164 + 7;
        for (int i = 0; i < 9; i++)
        {
            disp_draw_point(x + i, y, RGB565_COLOR_WHITE);
            disp_draw_point(x + 11 + i, y, RGB565_COLOR_WHITE);
        }
    }
    else
    {
        int units = 100;
        int num = 0;
        int x = 38;
        int const y = 165;
        for (int i = 0; i < 3; i++)
        {
            num = heart_rate / units;
            heart_rate = heart_rate % units;
            disp_draw_user_image(x, y, img_time_0_num_TAB[num]);
            units /= 10;
            x += 9 + 2;
        }
    }
}
static void show_time_4_time(void)
{
    disp_draw_user_image(78, 71, img_time_4_point);
    uint8_t const img_time_3_num_TAB[] = {
        FILE_IMG_5200_time_0_3_57, /* 49 */
        FILE_IMG_5201_time_1_3_57, /* 50 */
        FILE_IMG_5202_time_2_3_57, /* 51 */
        FILE_IMG_5203_time_3_3_57, /* 52 */
        FILE_IMG_5204_time_4_3_57, /* 53 */
        FILE_IMG_5205_time_5_3_57, /* 54 */
        FILE_IMG_5206_time_6_3_57, /* 55 */
        FILE_IMG_5207_time_7_3_57, /* 56 */
        FILE_IMG_5208_time_8_3_57, /* 57 */
        FILE_IMG_5209_time_9_3_57, /* 58 */
    };
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, 3, 56, img_time_3_num_TAB[disp_ctrl.com_data.i_temp[3] / 10]);
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, 39, 56, img_time_3_num_TAB[disp_ctrl.com_data.i_temp[3] % 10]);
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_2, 101, 56, img_time_3_num_TAB[disp_ctrl.com_data.i_temp[4] / 10]);
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_3, 139, 56, img_time_3_num_TAB[disp_ctrl.com_data.i_temp[4] % 10]);
}
static void show_time_4_second(void)
{
    disp_draw_user_image(114, 84, img_time_4_second_back);
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.com_data.i_temp[22] = (RTCGetSeconds() % 60) * 6;
    }
    disp_draw_img_rotate(gImage_second, 0, 48, (174 << 16) | 143, disp_ctrl.com_data.i_temp[22]);
}
static void show_time_4_date(void)
{
    disp_draw_user_image(212, 53, img_time_0_num_TAB[disp_ctrl.com_data.i_temp[2] / 10]);
    disp_draw_user_image(212 + 2 + 9, 53, img_time_0_num_TAB[disp_ctrl.com_data.i_temp[2] % 10]);
}
static void show_time_4_week(void)
{
    disp_draw_user_image(206, 36, img_time_4_week_TAB[disp_ctrl.com_data.i_temp[5] - 1]);
}
void view_time_4_display(void)
{
    show_time_0_ble();
    show_time_0_battery(disp_ctrl.com_data.i_temp[7], disp_ctrl.com_data.i_temp[8]);
    show_time_4_icon();
    show_time_4_steps();
    show_time_4_heart_rate();
    show_time_4_second();
    show_time_4_time();
    show_time_4_date();
    show_time_4_week();
}
#endif
